package Demo1;

import java.util.Objects;

public class Address {
    private String City;

    private int streetID;


    public String getCity() {
        return City;
    }

    public void setCity(String city) {
        City = city;
    }

    public int getStreetID() {
        return streetID;
    }

    public void setStreetID(int streetID) {
        this.streetID = streetID;
    }

    @Override
    public String toString() {
        return "Address{" +
                "City='" + City + '\'' +
                ", streetID=" + streetID +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Address address)) return false;
        return streetID == address.streetID && Objects.equals(City, address.City);
    }

    @Override
    public int hashCode() {
        return Objects.hash(City, streetID);
    }

    public Address() {
    }

    public Address(String city, int streetID) {
        City = city;
        this.streetID = streetID;
    }
}
